library(readxl)
pwt1950 <- read_excel("pwt1950.xlsx")
jpn<-subset(pwt1950,countrycode=="JPN")
usa<-subset(pwt1950,countrycode=="USA")

plot(usa$year,usa$percapitaGDP,type = "o",ylim = c(1000,80000))
points(jpn$year,jpn$percapitaGDP,type = "o")
text(1990,45000,"USA")
text(1990,25000,"JPN")

#Germany versus Japan
deu<-subset(pwt1950,countrycode=="DEU")

plot(deu$year,deu$percapitaGDP,type = "o",ylim = c(1000,80000))
points(jpn$year,jpn$percapitaGDP,type = "o")
text(2010,47000,"DEU")
text(2010,35000,"JPN")

日本とイギリス

library(readxl)
pwt1950 <- read_excel("pwt1950.xlsx")
JPN<-subset(pwt1950,countrycode=="JPN")
GBR<-subset(pwt1950,countrycode=="GBR")
plot(GBR$year,GBR$percapitaGDP,type = "o",ylim =  c(1000,80000),col=4)
points(JPN$year,JPN$percapitaGDP,type = "o")
text(2010,45000,"GBR")
text(2010,35000,"JPN")

日本とフランス

library(readxl)
pwt1950 <- read_excel("pwt1950.xlsx")
JPN<-subset(pwt1950,countrycode=="JPN")
FRA<-subset(pwt1950,countrycode=="FRA")
plot(FRA$year,FRA$percapitaGDP,type = "o",ylim =  c(1000,80000),col=4)
points(JPN$year,JPN$percapitaGDP,type = "o")
text(2010,45000,"FRA")
text(2010,35000,"JPN")

library(readxl)
df <- read_excel("pwt1950.xlsx")
## You can use the below code to generate the graph.
## Don't forget to replace the 'df' with the name
## of your dataframe

# You need the following package(s):
library("ggplot2")

# The code below will generate the graph:
graph <- ggplot(df, aes(x = year, y = percapitaGDP, colour = countrycode)) +
  geom_point()+
  geom_smooth(se = FALSE, method = 'lm') +
  theme_bw()
graph
## `geom_smooth()` using formula = 'y ~ x'

# If you want the plot to be interactive,
# you need the following package(s):
library("plotly")
## 
## Attaching package: 'plotly'
## 
## The following object is masked from 'package:ggplot2':
## 
##     last_plot
## 
## The following object is masked from 'package:stats':
## 
##     filter
## 
## The following object is masked from 'package:graphics':
## 
##     layout
ggplotly(graph)
## `geom_smooth()` using formula = 'y ~ x'
# If you would like to save your graph, you can use:
ggsave('my_graph.pdf', graph, width = 14, height = 14, units = 'cm')
## `geom_smooth()` using formula = 'y ~ x'